<?php

if(isset($_POST['Job'])){
    $model=new Job;
    if(isset($_POST['Job']))
    {
        $model->attributes=$_POST['Job'];
    }
    $model->other = $_POST['Job']['other'];

    $model->uid=YII::app()->user->id;
    $model->createtime=date("Y-m-d");
    $model->validate();
    $form=new  CActiveForm;
    $error=$form->errorSummary($model);
    if(empty($error)){
        $model->save();
        $this->redirect($this->createUrl('manage/index',array('cate'=>6)));
        return ;
    }
}

?>

<div class="detailContent" style="min-height: 1305px">
<form method="post">
<?php if(isset($error)) echo $error; ?>

<table width="600" cellspacing="0" cellpadding="0" border="0" align="center" class="table2">
    <tbody><tr>
        <td width="17%" align="right">招聘职位：</td>
        <td width="83%">
            <input type="text" id="textfield" class="text" name="Job[title]"
                   value="<?php if(isset($_POST['Job']['title'])) echo $_POST['Job']['title']; ?>" />
            &nbsp;<span style=" color:#7f807b; font-size:12px;">限制20个字符以内</span></td>
    </tr>
    <tr>
        <td align="right">招聘人数：</td>
        <td><input type="text" id="textfield2" class="text120" name="Job[number]"
                   value="<?php if(isset($_POST['Job']['number'])) echo $_POST['Job']['number']; ?>" />
            &nbsp;<span style=" color:#7f807b; font-size:12px;">仅填数字</span></td>
    </tr>
    <tr>
        <td align="right">工作地点：</td>
        <td><input type="text" id="textfield3" class="text" name="Job[place]"
               value="<?php if(isset($_POST['Job']['place'])) echo $_POST['Job']['place']; ?>" />
        </td>
    </tr>
    <tr>
        <td align="right">招聘时间：</td>
        <td>
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tbody><tr>
                    <td width="170"><span style="color:#7f807b; font-size:12px;">起
                        <?php
                        $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                            'attribute'=>'stime',
                            'language'=>'zh_cn',
                            'name'=>'Job[stime]',
                            'value'=> isset($_POST['Job']['stime']) ? $_POST['Job']['stime'] : '',
                            'options'=>array(
                                'showAnim'=>'fold',
                                'showOn'=>'both',
                                'buttonImage'=>Yii::app()->request->baseUrl.'/images/date.gif',
                                'buttonImageOnly'=>false,
                                'minDate'=>'new Date()',
                                'dateFormat'=>'yy-mm-dd',
                            ),
                            'htmlOptions'=>array(
                                'class'=>'text80',
                                 'readonly'=>'readonly',
                            ),
                        ));
                        ?>
                    - -</td>
                    <td><span style="color:#7f807b; font-size:12px;">止</span>
                        <?php

                        $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                            'attribute'=>'etiem',
                            'language'=>'zh_cn',
                            'name'=>'Job[etime]',
                            'value'=> isset($_POST['Job']['etime']) ? $_POST['Job']['etime'] : '',
                            'options'=>array(
                                'showAnim'=>'fold',
                                'showOn'=>'both',
                                'buttonImage'=>Yii::app()->request->baseUrl.'/images/date.gif',
                                'buttonImageOnly'=>false,
                                'minDate'=>'new Date()',
                                'dateFormat'=>'yy-mm-dd',
                            ),
                            'htmlOptions'=>array(
                                'class'=>'text80',
                                'readonly'=>'readonly',
                            ),
                        ));
                        ?></td>
                </tr>
                </tbody></table></td>
    </tr>
    <tr>
        <td align="right">薪资待遇： </td>
        <td><select name="Job[pay]">
            <option value="">请选择</option>
            <option <?php if(isset($_POST['Job']['pay']) && $_POST['Job']['pay']=='1000~2000'){
                echo 'selected="selected"';
            }?> value="2000~4000">1000~2000</option>
            <option <?php if(isset($_POST['Job']['pay']) && $_POST['Job']['pay']=='2000~4000'){
                echo 'selected="selected"';
            }?> value="2000~4000">2000~4000</option>
            <option <?php if(isset($_POST['Job']['pay']) && $_POST['Job']['pay']=='4000~6000'){
                echo 'selected="selected"';
            }?> value="4000~6000">4000~6000</option>
            <option <?php if(isset($_POST['Job']['pay']) && $_POST['Job']['pay']=='6000~10000'){
                echo 'selected="selected"';
            }?> value="6000~10000">6000~10000</option>
            <option <?php if(isset($_POST['Job']['pay']) && $_POST['Job']['pay']=='10000以上'){
                echo 'selected="selected"';
            }?> value="10000以上">10000以上</option>
        </select></td>
    </tr>
    <tr>
        <td align="right">工作性质：</td>
        <td><input type="radio" value="1" id="radio" name="Job[type]" <?php if(isset($_POST['Job']['type']) && $_POST['Job']['type']==1){
            echo 'checked="checked"';
        }?> />
            <label for="radio"></label>
            全职
            <input type="radio" value="2" id="radio2" name="Job[type]" <?php if(isset($_POST['Job']['type']) && $_POST['Job']['type']==2){
                echo 'checked="checked"';
            }?> />
            <label for="radio2"></label>
            兼职</td>
    </tr>
    <tr>
        <td valign="top" align="right">职位要求：</td>
        <td><textarea class="texta" id="textfield6" rows="6" name="Job[require]"><?php
            if(isset($_POST['Job']['require'])) echo $_POST['Job']['require'];
            ?></textarea></td>
    </tr>
    <tr>
        <td valign="top" align="right">职责描述：</td>
        <td><textarea class="texta" id="textfield7" rows="6" name="Job[desc]"><?php
            if(isset($_POST['Job']['desc'])) echo $_POST['Job']['desc'];
            ?></textarea></td>
    </tr>
    <tr>
        <td align="right">联系方式：</td>
        <td><input type="text" id="textfield8" class="text" name="Job[contact]"
               value="<?php if(isset($_POST['Job']['place'])) echo $_POST['Job']['place']; ?>" /></td>
    </tr>
    <tr>
        <td valign="top" align="right">其它说明：</td>
        <td><textarea id="textfield9" rows="6" class="texta" name="Job[other]"><?php
            if(isset($_POST['Job']['other'])) echo $_POST['Job']['other'];
            ?></textarea></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    </tbody></table>

<div class="sq paddingbotton80 paddingtop50">
    <input id="tjshfb" type="submit" style="border: 0;height: 26px;font-size: 0;" value="提交审核并发布" />
</div>

    </form>
</div>
<script type="text/javascript">

//$("#Job_stime").val(<?php if(isset($_POST['Job']['stime'])) echo $_POST['Job']['stime'];?>);
//$("#Job_etime").val(<?php if(isset($_POST['Job']['etime'])) echo $_POST['Job']['etime'];?>);

</script>